package com.kongyz;

import java.util.ArrayList;
import java.util.List;

/**
 * @author kongyz
 * @date 2018/6/28 21:53
 * @Description: 公司职员表
 */
public class Employee {
    private String name;
    private String dept;
    //薪水
    private int salary;
    //下属
    private List<Employee> subordinates;

    public Employee(String name, String dept, int salary) {
        this.name = name;
        this.dept = dept;
        this.salary = salary;
        subordinates=new ArrayList<Employee>();
    }

    public void add(Employee e){
        subordinates.add(e);
    }

    public void remove(Employee e){
        subordinates.remove(e);
    }

    public List<Employee> getSubordinates(){
        return subordinates;
    }

    @Override
    public String toString() {
        return "员工：["+name+","+dept+","+salary+"]";
    }
}
